package pers.zh.parking.mvp.model;

import android.app.Application;

import com.google.gson.Gson;

import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;

import com.jess.arms.di.scope.ActivityScope;


import javax.inject.Inject;

import io.reactivex.Observable;
import pers.zh.parking.common.ApiService;
import pers.zh.parking.common.BaseResponse;
import pers.zh.parking.data.entity.User;
import pers.zh.parking.mvp.contract.UserContract;

@ActivityScope
public class UserModel extends BaseModel implements UserContract.Model {

    @Inject
    Gson mGson;
    @Inject
    Application mApplication;

    @Inject
    public UserModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    @Override
    public Observable<BaseResponse> updateUser(User user) {
        return mRepositoryManager.obtainRetrofitService(ApiService.class).updateUser(user);
    }
}